#ifndef SWP_PROCESS_EDITOR_H
#define SWP_PROCESS_EDITOR_H

#include "abstractgraphiceditor.h"

namespace swp
{
class SwpSwimlaneGraphicItem;

class SwpProcessEditor : public AbstractGraphicEditor
{
    Q_OBJECT

public:
    SwpProcessEditor(QWidget* parent = 0);
    ~SwpProcessEditor();

    QStringList galleryGroups() const;
    QList<core::GalleryItem> galleryItems(const QString& group) const;

    IEditor* copy() const;

    bool eventFilter(QObject* watched, QEvent* event);

protected:
    RemoveGraphicItemCommand* removeItemCommand(
        core::IGraphicEditorItem *item) const;

    void dragEnterEvent(QDragEnterEvent* event);
    void dragMoveEvent(QDragMoveEvent *event);
    void dropEvent(QDropEvent *event);

private:
    void createThumbnails();
    void createMimeData();
    void createActions();
    void connectSlots();
    qreal swimlaneAvailablePosition(
        SwpSwimlaneGraphicItem*& previous) const;

private slots:
    void createNewStartPoint(QPoint where = QPoint());
    void createNewEndPoint(QPoint where = QPoint());

    void createNewDecision(QPoint where = QPoint());
    void createNewActivity(QPoint where = QPoint());

    void createNewJoin(QPoint where = QPoint());
    void createNewSplit(QPoint where = QPoint());
    void createNewMerge(QPoint where = QPoint());

    void createConnector();

    void addSwimlane();

private:
    QAction* m_addStartPointAction;
    QAction* m_addEndPointAction;
    QAction* m_addDecisionAction;
    QAction* m_addActivityAction;
    QAction* m_addJoinAction;
    QAction* m_addSplitAction;
    QAction* m_addMergeAction;

    QAction* m_createConnectorAction;

    QAction* m_addPoolLaneAction;

    QMimeData* m_startPointMimeData;
    QMimeData* m_endPointMimeData;
    QMimeData* m_decisionMimeData;
    QMimeData* m_activityMimeData;
    QMimeData* m_joinMimeData;
    QMimeData* m_splitMimeData;
    QMimeData* m_mergeMimeData;

    QPixmap m_startPointThumbnailDrag;
    QPixmap m_startPointThumbnailGallery;
    QPixmap m_endPointThumbnailDrag;
    QPixmap m_endPointThumbnailGallery;
    QPixmap m_decisionThumbnailDrag;
    QPixmap m_decisionThumbnailGallery;
    QPixmap m_activityThumbnailDrag;
    QPixmap m_activityThumbnailGallery;
    QPixmap m_joinThumbnailDrag;
    QPixmap m_joinThumbnailGallery;
    QPixmap m_splitThumbnailDrag;
    QPixmap m_splitThumbnailGallery;
    QPixmap m_mergeThumbnailDrag;
    QPixmap m_mergeThumbnailGallery;
    QPixmap m_connectorThumbnailGallery;
    QBitmap m_connectorThumbnailConnect;

    static const QString ACCEPTED_MIMETYPE;
    static const QString START_POINT_MIMETYPE_DATA;
    static const QString END_POINT_MIMETYPE_DATA;
    static const QString DECISION_MIMETYPE_DATA;
    static const QString ACTIVITY_MIMETYPE_DATA;
    static const QString JOIN_MIMETYPE_DATA;
    static const QString SPLIT_MIMETYPE_DATA;
    static const QString MERGE_MIMETYPE_DATA;
};

}

#endif
